package com.hst.capacity.infra.convertor;

import com.hst.capacity.domain.model.entity.order.express.ExpressOrderDestroyEntity;
import com.hst.capacity.domain.model.entity.order.intercity.IntercityOrderDestroyEntity;
import com.hst.capacity.domain.model.entity.order.pool.OrderPoolEntity;
import com.hst.capacity.domain.model.entity.order.specialcar.SpCarOrderDestroyEntity;
import com.hst.capacity.domain.model.entity.order.specialcar.SpCarOrderHistoryEntity;
import com.hst.capacity.domain.model.request.express.ExOrderDestroyParam;
import com.hst.capacity.domain.model.request.intercity.IcOrderDestroyParam;
import com.hst.capacity.domain.model.request.orderpool.OrderPoolAiParam;
import com.hst.capacity.domain.model.request.orderpool.OrderPoolParam;
import com.hst.capacity.domain.model.request.specialcar.SpOrderDestroyParam;
import com.hst.capacity.domain.model.response.PagingResultVO;
import com.hst.capacity.domain.model.response.order.OrderPoolVO;
import com.hst.capacity.domain.model.response.order.OrderVO;
import com.hst.capacity.domain.model.response.specialcar.SpSearchVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

/**
 *  专车订单模块的POJO属性转换器
 *
 * @author jin
 * */
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface OrderPoolConvertor {

    OrderPoolConvertor INSTANCE = Mappers.getMapper(OrderPoolConvertor.class);

    @Mapping(target="appointmentTime", dateFormat="yyyy-MM-dd HH:mm")
    OrderPoolVO convert(OrderPoolEntity entity);

    @Mapping(target="appointmentTime", dateFormat="yyyy-MM-dd HH:mm")
    OrderVO convert2VO(OrderPoolEntity entity);

    OrderPoolEntity convertHistory(SpCarOrderHistoryEntity entity);

    PagingResultVO<OrderPoolVO> convertNew(PagingResultVO<OrderPoolEntity> orderEntity);

    PagingResultVO<SpSearchVO> convertSearch(PagingResultVO<OrderPoolEntity> orderEntity);

    @Mapping(target="appointmentTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="assignTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="deptime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="desttime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="startServiceTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="endServiceTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="idStation", source = "idRailwayStation")
    OrderPoolEntity convert(OrderPoolParam param);

    @Mapping(target="appointmentTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="assignTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="deptime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="desttime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="startServiceTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="endServiceTime", dateFormat="yyyy-MM-dd HH:mm")
    @Mapping(target="idRailwayStation", source = "idStation")
    OrderPoolParam convert2Param(OrderPoolEntity entity);

    ExpressOrderDestroyEntity convert(ExOrderDestroyParam param);

    IntercityOrderDestroyEntity convert(IcOrderDestroyParam param);



    @Mapping(target="appointmentTime", dateFormat="yyyy-MM-dd HH:mm")
    OrderPoolParam convert(OrderPoolAiParam param);

}
